if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(X86_64)|(x64)|(X64)|(amd64)|(AMD64)|(i686)")
    if (APPLE)
        add_definitions(-fno-stack-check) # Workaround a Xcode 11.X bug
    endif()
    option(MNN_OPTIMIZE_INT8_SSE "use sse to compute int8" OFF)
    message(STATUS "${CMAKE_SYSTEM_PROCESSOR}: Open SSE")
    add_definitions(-DMNN_USE_SSE)
    FILE(GLOB MNN_X8664_SRC ${CMAKE_CURRENT_LIST_DIR}/*)
    FILE(GLOB MNN_AVX_SRC ${CMAKE_CURRENT_LIST_DIR}/avx/*)
    FILE(GLOB MNN_SSE_SRC ${CMAKE_CURRENT_LIST_DIR}/sse/*)
    add_library(MNNX8664 OBJECT ${MNN_X8664_SRC})
    add_library(MNNAVX OBJECT ${MNN_AVX_SRC})
    add_library(MNNSSE OBJECT ${MNN_SSE_SRC})
    add_dependencies(MNNX8664 MNNAVX MNNSSE)
    if(WIN32 OR MSVC)
        target_compile_options(MNNAVX PRIVATE /arch:AVX)
    else()
        target_compile_options(MNNSSE PRIVATE -msse3 -mfma)
        target_compile_options(MNNAVX PRIVATE -mavx -mfma)
    endif()
    if (MNN_OPTIMIZE_INT8_SSE)
        target_compile_options(MNNX8664 PRIVATE -DMNN_OPTIMIZE_INT8_SSE)
        target_compile_options(MNNAVX PRIVATE -DMNN_OPTIMIZE_INT8_SSE)
    endif()
    list(APPEND MNN_OBJECTS_TO_LINK $<TARGET_OBJECTS:MNNX8664> $<TARGET_OBJECTS:MNNAVX> $<TARGET_OBJECTS:MNNSSE>)
endif()
